home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 12 / 012.d81 / pps #26 < prev    next >
Text File  |  2022-08-26  |  3KB  |  117 lines

  1.  
  2.  PEEKs, POKEs, AND SYSes -- Part 26
  3.  
  4.              "ARRAYS"
  5.  
  6.    by Alan Gardner and Jimmy Weiler
  7.  
  8. ======================================
  9. Location: 49-50    Hexadecimal: $31-32
  10. Official label: STREND        Type:RAM
  11. Useful BASIC commands:      PEEK, POKE
  12. ======================================
  13.  
  14.   In our last installment we learned
  15.  
  16. about simple variables.  This month we
  17.  
  18. tackle subscripted variables, also
  19.  
  20. known as arrays.
  21.  
  22.   Last time we saw that simple
  23.  
  24. variables are stored from VARTAB to
  25.  
  26. ARYTAB (variable table to array table)
  27.  
  28. and we looked at how each variable was
  29.  
  30. stored, byte by byte.  Arrays are
  31.  
  32. stored from ARYTAB to STREND (array
  33.  
  34. table to end of strings).  In this
  35.  
  36. edition of PEEKs, POKEs and SYSes we
  37.  
  38. will discuss how arrays are laid out.
  39.  
  40.   Let's start with a chart of BASIC
  41.  
  42. RAM to review what we already know
  43.  
  44. about variables.  Remember that the
  45.  
  46. pointers named in the left column
  47.  
  48. RESIDE at addresses from 43 to 55 but
  49.  
  50. that they POINT TO addresses from 2049
  51.  
  52. to 40960.
  53.  
  54. ======================================
  55. CHART 1: a review of BASIC RAM
  56. --------------------------------------
  57.  Memory,
  58.  Pointers &
  59.  Pointers'       Description
  60.  addresses
  61. --------------------------------------
  62. !adr=40960!
  63. !MEMSIZ=55!Highest BASIC RAM address.
  64. !         !Strings are stored from
  65. !         !here down to FRETOP.
  66. !(strings)!
  67. !FRETOP=51!Top of free variable space.
  68. !         !Lowest excursion of string
  69. !         !storage.  There are no
  70. !         !variables between here and
  71. !         !STREND. As more strings are
  72. !         !used, FRETOP drops toward
  73. !         !STREND.
  74. !( empty )!
  75. !STREND=49!End of string space.  If
  76. !         !string variables push
  77. !         !FRETOP down to here,
  78. !         !garbage collection happens.
  79. !         !When FRETOP overlaps STREND
  80. !         !you get an OUT OF MEMORY
  81. !         !error.
  82. !(arrays )!
  83. !ARYTAB=47!Array table.  Arrays extend
  84. !         !up from here to STREND.
  85. !(simple )!
  86. !(var's. )!
  87. !VARTAB=45!Variable table.  Simple
  88. !         !variables start right above
  89. !         !the BASIC program and
  90. !( basic )!extend up to the arrays.
  91. !(program)!
  92. !TXTTAB=43!Text table.  BASIC text
  93. !-adr=2048!starts here and extends up
  94.            to VARTAB.
  95. ======================================
  96.  
  97.   Usually, TXTTAB and MEMSIZ remain
  98.  
  99. constant.  The pointers VARTAB,
  100.  
  101. ARYTAB, STREND, and FRETOP can contain
  102.  
  103. addresses for any RAM address
  104.  
  105. depending on the size of the BASIC
  106.  
  107. program and what variables it uses.
  108.  
  109.   Enough review.  In this installment
  110.  
  111. we're primarily interested in the
  112.  
  113. memory from VARTAB to STREND.
  114.  
  115.  
  116. -------< continued in Part 27 >-------
  117.